package db;

/**
 * 从db中,批量获取数据
 *
 * @Author: ycy
 * @CreateDate: 2019/6/6 13:20
 */
public class SelectByFetchFromDB {
  /**
   * 分批,根据poitype获取gl_poi全量数据
   * 之后对businessid排序(在程序里面排序对db的性能会降低)
   *
   * @param type
   * @return
   */
  /*private List<GsPoiImageInfo> getGlPoiByPoiTypeOrderByBusinessId(String type) {
    //获取全量数据
    List<GsPoiImageInfo> productIdInfos = Lists.newArrayList();
    try {
      Long maxPK = gsPoiDao.getLimitProductID(new DalHints(), String.format(SQL.getInstance().get("LocalPoiImageInfoAllByPoiTypeMax"), type));
      Long start = gsPoiDao.getLimitProductID(new DalHints(), String.format(SQL.getInstance().get("LocalPoiImageInfoAllByPoiTypeMin"), type));
      Long end;
      Long add = 5000000L;
      do {
        end = start + add;
        List<GsPoiImageInfo> productIdInfo = gsPoiDao.queryBySql(String.format(SQL.getInstance().get("LocalPoiImageInfoAllByPoiType"), type, start, end));
        if (productIdInfo != null && !productIdInfo.isEmpty()) {
          productIdInfos.addAll(productIdInfo);
        }
        start = end;
      } while (end < maxPK);

      //在程序里面排序,防止大数据量排序查询时,影响db数据
      if (productIdInfos != null && !productIdInfos.isEmpty()) {
        productIdInfos.sort(new GsPoiImageInfoCompare());
      }
    } catch (SQLException e) {
      e.printStackTrace();
    }
    logger.info("load {} poi {} rows", type, productIdInfos.size());
    return productIdInfos;
  }
*/



}
